/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package application.dao;

import java.util.ArrayList;
import java.util.List;

import org.hibernate.SessionFactory;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import application.model.DistanceCalcSettings;
/**
 *
 * @author aa6345
 */
@Repository("distanceCalcDao")
public class DistanceCalcDaoImpl implements DistanceCalcDao{

    @Autowired
    private SessionFactory sessionFactory;
    
    public List<DistanceCalcSettings> getAllDistanceCalcSettings() {
        List<DistanceCalcSettings> settings = new ArrayList<DistanceCalcSettings>();
        String searchQuery = "select `numOfMatchesA`, "
                + "`numOfMatchesWeightA`,"
                + "`degreeOfMatchA`,"
                + "`degreeOfMatchWeightA`,"
                + "`numOfMatchesB`,"
                + "`numOfMatchesC`,"
                + "`numOfMatchesD`,"
                + "`numOfMatchesWeightB`,"
                + "`numOfMatchesWeightC`,"
                + "`numOfMatchesWeightD`,"
                + "`degreeOfMatchB`,"
                + "`degreeOfMatchC`,"
                + "`degreeOfMatchWeightB`,"
                + "`degreeOfMatchWeightC`,"
                + "`id`"
                + "from distancecalcsettings dcs ;";

            settings = sessionFactory.getCurrentSession().createSQLQuery(searchQuery).addEntity(DistanceCalcSettings.class).list();

        return settings;
    }
}
